package main

import "fmt"

/*
*
defer 进栈出栈
*/
func main() {
	defer fmt.Println("defer 01")
	defer fmt.Println("defer 02")

	fmt.Println("normal 3")
	fmt.Println("normal 4")

	fmt.Println("===========")

	testDeferAndReturn()
}

func testDeferAndReturn() int {
	defer deferResult()
	return returnResult()
}

func deferResult() int {
	fmt.Println("defer result")
	return 0
}

func returnResult() int {
	fmt.Println("return result")
	return 0
}
